﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="USpecialCaseDetailList.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.UserModel.USpecialCaseDetailList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../EasyUI/themes/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../EasyUI/themes/icon.css" />
	<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>   
	<script type="text/javascript" src="../EasyUI/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-formatter_20140718.js"></script>
    <script src="../js/DWZ/jquery.inputValue.js" type="text/javascript"></script>
    <style type="text/css">
        .datagrid-toolbar {
            background: none repeat scroll 0 0 #EFEFEF;
            border-bottom: 1px solid #CCCCCC;
            height: 56px!important;
            padding: 1px 2px;
        }
        .datagrid-toolbar-quicksearch
        {
             clear:both; line-height:25px; border-bottom:1px solid #99BBE8; margin-bottom:2px;
        }
    </style>
    <script type="text/javascript">
       ///自适应宽高
       $(window).resize(function(){		    
             $("#tab_list").datagrid({
                    width: '100%',
                    height: $(parent.document).find(".tabsPageContent").height() - 11 > 0 ? $(parent.document).find(".tabsPageContent").height() - 11 : 500,
             }); 
	    });
        //权限处理
        var $powers={
            "r查看":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.查看) %>,
            "r新增":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.新增) %>,
            "r修改":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.修改) %>,
            "r删除":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.删除) %>,
            "r导出":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.导出) %>     
        };

        $(document).ready(function () {
            var $tab_toolbar=$("#tab_toolbar");
            $tab_toolbar.find("a").each(function(){
                var $per=$(this).attr("Permission");
                var pt= $powers[$per]==undefined || null?true:$powers[$per];
                $(this).linkbutton(pt?'enable': 'disable');
            })           
           
            //加载数据
            InitGird();           
        })
        //加载列表数据
        function InitGird() {
            $('#tab_list').datagrid({               
                url: location.href, //请求数据的页面
                sortName: 'ID', //排序字段
                sortOrder: 'DESC', //排序类型
                idField: 'ID', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度    
                height: $(parent.document).find(".tabsPageContent").height() - 11 > 0 ? $(parent.document).find(".tabsPageContent").height() - 11 : 500,
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                singleSelect: true, //是否只能选中一条
                remoteSort: true, //定义是否从服务器给数据排序
                frozenColumns: [[//冻结的列，不会随横向滚动轴移动                    
                   
				]],
                columns: [[  
                     {title:'ID',field:'ID',width: 80,sortable:true},
                    {title: '经销商', field: 'AgentName', width: 120, align:'center',sortable: true},
                    {title: '机号', field: 'SerialNumber', width: 100, align:'center',sortable: true},
                    {title: '是否处理', field: 'IsHandle', width: 100, align:'center',sortable: true,formatter:function(value, row, index){
                         if(value==undefined)
                                return""; 
                         return value?"已处理":"未处理";
                     } },
                    {title: '处理时间', field: 'HandleDate',formatter:formatterdate, width: 120, align:'center',sortable: true}
                ]],
                toolbar: "#tab_toolbar",
                queryParams: { "action": "query" },
                pagination: true, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: <%=numPerPage %>, //默认一页数据条数
                pageList:<%=SetnumPerPage() %>,
                rownumbers: true, //行号
                showFooter: true
            });

        } 
    </script>
    <script>
        //操作功能JS

        //打开高级查找窗口
        function onAdjSearch() {

            var query = $("#tab_search").serializeJSON(); // GetInputData("tab_search", "query");
            query.action = "query";
            $('#tab_list').datagrid("options").queryParams = query;
            $('#tab_list').datagrid('load');
            $("#tab_search").dialog("close");
            return false;

            $("#tab_search").dialog("open");
            $("#search-buttons").find("#btn_search").one("click", function () {


            });
        }
      
        //添加
        function onAddClick() {

            var rel = "USpecialCaseDetailAdd";
            var url = "UserModel/USpecialCaseDetailAdd.aspx?SCID=<%=SCID %>";
            var title = "添加";
            var options = { width: 800, height: 400, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            top.$.pdialog.open(url, rel, title, options);
            //top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            return false;
        }

        //修改，通过工具栏
        function onEditClick() {

            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要修改的记录');
                return false;
            }
            var id = row.ID;
            var rel = "USpecialCaseDetailEdit";
            var url = "UserModel/USpecialCaseDetailEdit.aspx?id=" + id;
            var title = "修改";
            var options = { width: 800, height: 400, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            top.$.pdialog.open(url, rel, title, options);
            // top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }

        function onDelALLClick() {
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要删除的记录');
                return false;
            }
            var ID = row.ID;

            $.messager.confirm('提示', '确定要删除吗？', function (r) {
                if (r) {
                    var url = "sysAjaxDone.ashx?ajaxmethod=deleteuspecialcasedetail&ID=" + ID;
                    top.ajaxTodo(url, "");
                    $("#tab_list").datagrid("load");
                }
            });
        }
        function onExport() {
            //var href = "/ExportExcel/ExportOCRDList.aspx";
            // top.window.open(href, "");
        }

    </script>
</head>
<body style="margin:2px;" >
    <div id="tab_list"></div>
    <div id="tab_toolbar" style="padding:2px;">
       <div id="tab_search" style="" class="datagrid-toolbar-quicksearch">
            <span style="line-height:26px;width:60px; font-weight:bold; color:Red; ">快速查找:</span>
             &nbsp;
             <select name="CommonFiled" class="combox">       
                <option value="AgentName" >经销商</option>               
                <option value="SerialNumber" >机号</option>
            </select>
            等于：<input name="CommonValue" type="text" value="" onblur="onAdjSearch()" />
            <input type="hidden" name="SCID" value="<%=SCID %>" />
       </div>
       
       <a href="#" title="新增" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="return 　onAddClick()" Permission="r新增">新增</a>
       <a href="#" title="修改" class="easyui-linkbutton" iconcls="icon-save" plain="true" onclick="return　onEditClick();" Permission="r修改">修改</a>
       <a href="#" title="删除" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="return　onDelALLClick();" Permission="r删除">删除</a> 

    </div>  
   
</body>
</html>